const { createProxyMiddleware } = require('http-proxy-middleware');

const target = 'http://localhost:8080';

const proxy = createProxyMiddleware({
  target,
  changeOrigin: true,
  pathRewrite: {
    '^/api': '', // 将请求路径中的 /api 移除
  },
});

module.exports = function (app) {
  app.use('/api', proxy);
};
